package com.fengbaogu.bean;

import java.net.SocketAddress;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import io.netty.channel.Channel;

/**
 *存放实体
 * @author Administrator
 *
 */
public class MyMap {
	private  Map<SocketAddress, String> address ;
	private  Map<String, Channel> channels ;

	private MyMap() {
		System.out.println("执行了构造......");
		address = new ConcurrentHashMap<SocketAddress, String>();
		channels = new ConcurrentHashMap<String, Channel>();
	}
	private static class SingletonHolder{
        /**
         * 静态初始化器，由JVM来保证线程安全
         */
        private static MyMap instance = new MyMap();
    }

    public static MyMap getInstance(){
        return SingletonHolder.instance;
    }

	public Map<SocketAddress, String> getAddress() {
		return address;
	}

	public void setAddress(Map<SocketAddress, String> address) {
		this.address = address;
	}

	public Map<String, Channel> getChannels() {
		return channels;
	}

	public void setChannels(Map<String, Channel> channels) {
		this.channels = channels;
	}
    
	
}
